﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace TournamentOrganizerWPF
{
    /// <summary>
    /// Interaction logic for AddPlayerWindow.xaml
    /// </summary>
    public partial class AddPlayerWindow : Window
    {
        public Tournament tournament;

        public AddPlayerWindow(Tournament tournament)
        {
            InitializeComponent();
            this.tournament = tournament;
            this.DataContext = tournament;
            locations.SelectedIndex = 0;
        }



        private void AddPlayerToList(object sender, RoutedEventArgs e)
        {
            if (playerName.Text.Equals("") || locations.Text.Equals(""))
            {
                warningLabel.Content = "Write name and location of the player";
            }
            tournament.AddPlayer(new Player(tournament.PlayerList.Count + 1, playerName.Text, locations.SelectedItem.ToString()));
            playerName.Text = "";


        }

        private void ReturnToMainMenu(object sender, RoutedEventArgs e)
        {
            throw new NotImplementedException();
        }
    }
}
